<?php
namespace app\xcdy\controller;
use x\Xbase;
use x\Container;
class Base extends Xbase{
    public $userinfo = [];
    public $com = [];
    public $sys = [];
    public function __construct(){
        parent::__construct();
        clear_cookie_arr('js');
        $this->_sys();
        $this->_user();
    }

    //通用
    public function _sys(){
        $this->sys = m('Deploy','xcom')->lists();
        $this->assign('sys',$this->sys);
        $this->assign('m',$this->m);
        $this->assign('c',$this->c);
        $this->assign('a',$this->a);
    }

    //验证登陆
    public function _user(){
        $this->userinfo = m('User','c')->isLogin();
        $this->assign('userinfo',$this->userinfo);
    }

    //验证登录
    public function checkLogin(){
        if(!$this->userinfo){
            if(is_ajax()){
                err('请先登录!');
            }else{
                session('need_login_url',com_cur_url());
                jump('请先登录!',url('bbs/publics/login'),1,1);
            }
        }
    }
}
